/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Utils;

import samoloty.controler.Controler;

/**
 *
 * @author borysfan
 */
public class ScreensOrder {
    private static ScreensOrder instance = null;
    private int current;
    private static final int MAX_NUM = 6;
    private Controler controler;

    private ScreensOrder(){
        current=0;
    }

    public void setControler(Controler c){
        controler = c;
    }

    public static ScreensOrder getInstance(){
        if(instance==null){
            instance=new ScreensOrder();
        }
        return instance;
    }

    public void setResetPanel(){
        controler.setResetPanel();
    }

    public void setExitPanel(){
        controler.setExitPanel();
    }

    public void nextScreen(){
        current = controler.getCurrentPanelIdentity();
        if(current>=0){
            if(current<MAX_NUM){
                current++;
                setScreen();
            }
        }
    }

    public void prevScreen(){

        current = controler.getCurrentPanelIdentity();
        if(current>0){
                current--;
                setScreen();
        }
    }

    public void currentScreen(){
        setScreen();
    }

    private void setScreen(){        
        switch(current){
            case 0: controler.setFlightPanel();
                    break;
            case 1: controler.setDowPanel();
                    break;
            case 2: controler.setFuelPanel();
                    break;
            case 3: controler.setPaxPanel();
                    break;
            case 4: controler.setHoldPanel();
                    break;
            case 5: controler.setSiPanel();
                    break;
            
        }
    }


}
